;(function () {
    
    let keyword = document.querySelector('.soinput')
    let btn = document.querySelector('#searchBtn')
    
    function fn (){
        // alert(1)
        pAjax({
            url: '../server/search.php',
            type: 'post',
            data: {
                searchname : keyword.value
            }
        }).then(function (res) {
            list_arr = JSON.parse(res)
            console.log(list_arr);
            localStorage.setItem('search_list',list_arr)
            location.href = '../html/list.html'
        
        })
    }

    btn.addEventListener('click',fn)
    // btn.onclick(fn())
    keyword.addEventListener('keydown',function (ev) {
        if (ev.keyCode ===13) {
        fn()
    }
    })
})();
